package com.fly.consumers.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;

@Service
public class ConsumersService {

	@Autowired
	RestTemplate restTemplate;

	@HystrixCommand(fallbackMethod = "fallback")
	public String hello() {
		return restTemplate.getForObject("http://M-SKILL-ZUUL/client/test", String.class);
	}

	/**
	 * 	熔断
	 */
	public String fallback() {
		return "hi,sorry,error!";
	}

}
